<%-- 
    Document   : modificarBD
    Created on : 05-jun-2014, 17:32:31
    Author     : pargon
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="p3.accesoBD"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        
        <% if(request.getSession(true).getAttribute("admin") == null || request.getSession(true).getAttribute("admin").equals("")) {
        %><h1>No tienes permisos para acceder a esta p&aacute;gina</h1><%}
        else {
        %>    
        
        <table widht="100%"> 
            <tr width="100%">
                <td width="10%">idProducto</td>
                <td width="12%">Nombre</td>
                <td width="12%">Descripcion</td>
                <td width="12%">Precio</td>
                <td width="12%">Imagen</td>
                <td width="12%">Stock</td>
                <td width="12%">&nbsp;</td>
                <td width="12%">&nbsp;</td>
            </tr>
          <% 
              accesoBD bd = new accesoBD();
              ResultSet rs = bd.getCervezas();
              
              while(rs.next()) {
                  
          %>
          <tr>
              <td colspan="8">
                  <form action="" onsubmit="ProcesarForm(this,'updateProducto','cuerpo');return false;"><table>
                                  <tr>
                                      <td><input type="text" size="3" disabled="true" name="idProducto" value="<%= rs.getInt(1)+"" %>" /></td>
                                      <td><input type="text" size="15" name="nombre" value="<%= rs.getNString(2) %>" /></td>
                                      <td><input type="text" size="15" name="descripcion" value="<%= rs.getNString(4) %>" /></td>
                                      <td><input type="text" size="15" name="precio" value="<%= rs.getDouble(3) %>" /></td>
                                      <td><input type="text" size="15" name="imgsrc" value="<%= rs.getNString(6) %>" /></td>
                                      <td><input type="text" size="15" name="stock" value="<%= rs.getInt(5) %>" /></td>
                                      <td><input type="submit" value="Cambiar Datos"/></td>
                                      <td><input type="button" value="Eliminar Producto" onclick="Cargar('eliminarProducto?id=<%= rs.getInt(1)%>','cuerpo');return false;"/></td>
                                  </tr>
                      </table></form>
              </td>
              
          </tr>
          <% } %>
        <%}%>
       </body>
</html>
